load("@rules_cc//cc:defs.bzl", "cc_library")

licenses(["notice"])  # Apache 2

cc_library(
    name = "pagespeed_base_core",
    srcs = [
        "abstract_mutex.cc",
        "abstract_shared_mem.cc",
        "annotated_message_handler.cc",
        "atom.cc",
        "debug.cc",
        "file_message_handler.cc",
        "file_system.cc",
        "google_message_handler.cc",
        "message_handler.cc",
        "print_message_handler.cc",
        "statistics.cc",
        "stdio_file_system.cc",
        "string_convert.cc",
        "string_util.cc",
        "string_writer.cc",
        "symbol_table.cc",
        "time_util.cc",
        "timer.cc",
        "thread_system.cc",
        "writer.cc",
        #'mem_debug.cc',
        "null_message_handler.cc",
        "null_mutex.cc",
        "null_rw_lock.cc",
        "null_shared_mem.cc",
        "null_statistics.cc",
        "null_writer.cc",
    ],
    hdrs = [
        "abstract_mutex.h",
        "abstract_shared_mem.h",
        "annotated_message_handler.h",
        "atom.h",
        "basictypes.h",
        "debug.h",
        "dense_hash_map.h",
        "dense_hash_set.h",
        "dynamic_annotations.h",
        "file_message_handler.h",
        "file_system.h",
        "google_message_handler.h",
        "message_handler.h",
        "print_message_handler.h",
        "printf_format.h",
        "scoped_ptr.h",
        "sparse_hash_map.h",
        "stack_buffer.h",
        "statistics.h",
        "statistics_template.h",
        "stdio_file_system.h",
        "stl_util.h",
        "string.h",
        "string_hash.h",
        "string_util.h",
        "string_writer.h",
        "symbol_table.h",
        "thread_annotations.h",
        "thread_system.h",
        "time_util.h",
        "timer.h",
        "vector_deque.h",
        "writer.h",
        "null_message_handler.h",
        "null_mutex.h",
        "null_rw_lock.h",
        "null_shared_mem.h",
        "null_statistics.h",
        "null_writer.h",
    ],
    visibility = ["//visibility:public"],
    deps = [
        "//third_party/google-sparsehash:google_sparsehash_gen",
        "@boringssl//:ssl",
        "@com_google_absl//absl/base",
        "@com_google_absl//absl/container:flat_hash_map",
        "@com_google_absl//absl/container:node_hash_map",
        "@com_google_absl//absl/strings",
        "@com_google_absl//absl/strings:str_format",
        "@com_google_absl//absl/time",
        "@mod_pagespeed//base:log_shim",
    ],
)

cc_library(
    name = "gtest_prod",
    hdrs = ["gtest_prod.h"],
    visibility = ["//visibility:public"],
    deps = [
        "@com_google_googletest//:gtest",
    ],
)

cc_library(
    name = "pagespeed_base",
    srcs = [
        "cache_interface.cc",
        "charset_util.cc",
        "checking_thread_system.cc",
        "chunking_writer.cc",
        "circular_buffer.cc",
        "condvar.cc",
        "countdown_timer.cc",
        "escaping.cc",
        "fast_wildcard_group.cc",
        "file_writer.cc",
        "function.cc",
        "hasher.cc",
        "hostname_util.cc",
        "json_writer.cc",
        "md5_hasher.cc",
        "named_lock_manager.cc",
        "posix_timer.cc",
        "request_trace.cc",
        "rolling_hash.cc",
        "sha1_signature.cc",
        "shared_string.cc",
        "signature.cc",
        "source_map.cc",
        "split_statistics.cc",
        "split_writer.cc",
        "thread.cc",
        "waveform.cc",
        "wildcard.cc",
        "wildcard_group.cc",
    ],
    hdrs = [
        "arena.h",
        "atomic_bool.h",
        "atomic_int32.h",
        "atomicops.h",
        "base64_util.h",
        "cache_interface.h",
        "callback.h",
        "charset_util.h",
        "checking_thread_system.h",
        "chunking_writer.h",
        "circular_buffer.h",
        "condvar.h",
        "countdown_timer.h",
        "enum_set.h",
        "escaping.h",
        "fast_wildcard_group.h",
        "file_writer.h",
        "function.h",
        "hasher.h",
        "hostname_util.h",
        "inline_slist.h",
        "json.h",
        "json_writer.h",
        "manually_ref_counted.h",
        "md5_hasher.h",
        "named_lock_manager.h",
        "pool.h",
        "pool_element.h",
        "posix_timer.h",
        "proto_matcher.h",
        "proto_matcher_impl.h",
        "proto_util.h",
        "ref_counted_ptr.h",
        "request_trace.h",
        "rolling_hash.h",
        "sha1_signature.h",
        "shared_string.h",
        "signature.h",
        "source_map.h",
        "split_statistics.h",
        "split_writer.h",
        "string_multi_map.h",
        "thread.h",
        "waveform.h",
        "wildcard.h",
        "wildcard_group.h",
    ],
    visibility = ["//visibility:public"],
    deps = [
        ":gtest_prod",
        ":pagespeed_base_core",
        "@jsoncpp",
    ],
)
